package org.ehe.finance.payable.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 应付配置
 * @author :zhangnn
 * @className :PayableConfig
 * @description: TODO
 * @date 2025-09-02 10:42:19
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "erp.finance.payable")
public class PayableConfig {
    /** 单据号生成规则配置 */
    private BillNoConfig billNo = new BillNoConfig();

    /** 到期提醒配置 */
    private DueReminderConfig dueReminder = new DueReminderConfig();

    /** 付款限制配置 */
    private PaymentConfig payment = new PaymentConfig();

    @Data
    public static class BillNoConfig {
        /** 单据号前缀 */
        private String prefix = "YF";
        /** 日期格式 */
        private String dateFormat = "yyyyMMdd";
        /** 序号长度 */
        private int sequenceLength = 4;
        /** 是否按租户分别编号 */
        private boolean separateByTenant = true;
    }

    @Data
    public static class DueReminderConfig {
        /** 默认提醒天数 */
        private int defaultDays = 7;
        /** 是否开启自动提醒 */
        private boolean autoReminder = true;
        /** 提醒时间（小时） */
        private int reminderHour = 9;
    }

    @Data
    public static class PaymentConfig {
        /** 是否允许超额付款 */
        private boolean allowOverPayment = false;
        /** 付款精度（小数位数） */
        private int paymentPrecision = 2;
        /** 最小付款金额 */
        private String minPaymentAmount = "0.01";
    }
}
